# -*- coding: utf-8 -*-
import numpy as np

if __name__ == '__main__':
    # 创建一维数组
    lis = range(10)
    print lis
    ndarray = np.array(lis)
    print ndarray
    print ndarray.shape
    print ndarray.ndim
    print "-------创建二维数组--------------"
    lis2 =[range(10),range(10)]
    print lis2
    array = np.array(lis2)
    print array
    print array.shape
    print "-----创建特殊数组 参数是元组----------"
    print np.zeros((3,3))
    print np.ones((2,2))
    # 随机的数组
    print np.empty((4,4))
    print np.empty((2,2),int)
    print "----创建连续的数组----------------"
    arange = np.arange(10)
    print arange
    print "-------数据类型转换-----------------"
    zeros = np.zeros((3, 4), dtype=float)
    print zeros
    print zeros.dtype
    astype = zeros.astype(int)
    print astype
    print astype.dtype